import moment from 'moment';
import { repeatMonth } from './tool';
/* 所需要的图片 */
import { iconExcel, iconImg, iconPdf, iconWord } from '@/assets/icon/index.js';

export const GET_MONTH_VIEW_PARAMS = {
  beginDate: moment().startOf('month').format('YYYY-MM-DD'),
  endDate: moment().endOf('month').format('YYYY-MM-DD'),
};

export const WEEK_DAY = ['一', '二', '三', '四', '五', '六', '日'];

export const WEEK_ARR = [5, 6, 12, 13, 19, 20, 26, 27, 33, 34];

export const TYPEDATA: any = {
  todo: { type: 'todo', color: '#FF9F0A', title: '待办' },
  notice: { type: 'notice', color: '#30D485', title: '公告' },
  sequence: { type: 'sequence', color: '#18A0FB', title: '序列' },
};

export enum TABS_LIST {
  TODO_TABS_TYPE = 'DB', // 待办;
  NOTICE_SEQUENCE_TABS_TYPE = 'GG_XL', //公告序列；
  NOTICE_TABS_TYPE = 'GG', // 公告；
  SEQUENCE_TABS_TYPE = 'XL', // 序列；
}

export const TABS_LIST_TYPES = [
  { title: '待办', key: TABS_LIST.TODO_TABS_TYPE },
  { title: '公告', key: TABS_LIST.NOTICE_TABS_TYPE },
  { title: '序列', key: TABS_LIST.SEQUENCE_TABS_TYPE },
];

export enum TODO_STATUS {
  TODO_TYPE = 0, // 待办
  OVERDUE_TYPE = 1, // 过期
}

export const TODO_STATUS_TYPES = [
  {
    label: '待办',
    value: TODO_STATUS.TODO_TYPE,
    color: 'var(--font-a60)',
    backgroundColor: 'var(--warn-bg)',
  },
  {
    label: '过期',
    value: TODO_STATUS.OVERDUE_TYPE,
    color: 'var(--font-a60)',
    backgroundColor: 'rgba(255, 255, 255, 0.2)',
  },
];

export const TYPE_ARR = ['todo', 'notice', 'sequence'];

export const TODO_OPTIONS = [
  { label: '关联', value: 1 },
  // { label: '提醒设置', value: 2 },
  { label: '删除', value: 3 },
];

export const NOTICE_AND_SEQUENCE_OPTIONS = [
  { label: '创建待办', value: 1 },
  { label: '删除', value: 2 },
];

export enum CUSTOM_FLAGS {
  SYSTEM_AUTO = 0, // 系统同步
  CUSTOM = 1, // 自定义创建
}

export enum TYPE_LIST {
  SYSTEM_NOTICE = '1', //系统公告
  CUSTOM_NOTICE = '2', //自定义公告
  SYSTEM_SEQUENCE = '3', //系统序列
  CUSTOM_SEQUENCE = '4', //自定义序列
}

export enum DETAIL_TYPES {
  TODO = 'todo',
  NOTICE = 'notice',
  SEQUENCE = 'sequence',
}

export const TYPE_LIST_ARR = [
  { label: '公告', value: TYPE_LIST.SYSTEM_NOTICE, key: DETAIL_TYPES.NOTICE },
  { label: '公告', value: TYPE_LIST.CUSTOM_NOTICE, key: DETAIL_TYPES.NOTICE },
  { label: '交易序列', value: TYPE_LIST.SYSTEM_SEQUENCE, key: DETAIL_TYPES.SEQUENCE },
  { label: '交易序列', value: TYPE_LIST.CUSTOM_SEQUENCE, key: DETAIL_TYPES.SEQUENCE },
];

export enum REMINDER_TYPE {
  SMS = '1',
}

export const REMINDER_TYPE_LIST = [{ label: '短信', value: REMINDER_TYPE.SMS }];

export const CHECKTIME: Record<
  string,
  { value: string; label: string; millName: string; millNum: number }
> = {
  '-1': { value: '-1', label: '无', millName: 'notHas', millNum: -1 },
  '0': { value: '0', label: '准时', millName: 'punctual', millNum: 0 },
  '300000': { value: '300000', millName: 'minute', millNum: 5, label: '前5分钟' },
  '600000': { millName: 'minute', millNum: 10, label: '前10分钟', value: '600000' },
  '900000': { millName: 'minute', millNum: 15, label: '前15分钟', value: '900000' },
  '1800000': { millName: 'minute', millNum: 30, label: '前30分钟', value: '1800000' },
  '3600000': { millName: 'hour', millNum: 1, label: '前1小时', value: '3600000' },
  '7200000': { millName: 'hour', millNum: 2, label: '前2小时', value: '7200000' },
  '21600000': { millName: 'hour', millNum: 6, label: '前6小时', value: '21600000' },
  '43200000': { millName: 'hour', millNum: 12, label: '前12小时', value: '43200000' },
  '64800000': { millName: 'hour', millNum: 18, label: '前18小时', value: '64800000' },
  '86400000': { millName: 'hour', millNum: 24, label: '前24小时', value: '86400000' },
};

export const CHECKTIME_OPTIONS: { value: string; label: string }[] = [
  { label: '准时', value: '0' },
  { label: '前5分钟', value: '300000' },
  { label: '前10分钟', value: '600000' },
  { label: '前15分钟', value: '900000' },
  { label: '前30分钟', value: '1800000' },
  { label: '前1小时', value: '3600000' },
  { label: '前2小时', value: '7200000' },
  { label: '前6小时', value: '21600000' },
  { label: '前12小时', value: '43200000' },
  { label: '前18小时', value: '64800000' },
  { label: '前24小时', value: '86400000' },
];

export const IMG_TYPE: Record<string, any> = {
  xls: iconExcel,
  lsx: iconExcel,
  jpg: iconImg,
  png: iconImg,
  pdf: iconPdf,
  doc: iconWord,
  ocx: iconWord,
};

export enum TRADE_TYPE {
  BILATERAL = '1',
  CONCENTRATE = '2',
  LISTED = '3',
  CONTINUOUS_AUCTION = '4',
  ORTHER = '9',
}

export const TRADE_TYPE_MODE: Record<string, string> = {
  '1': '双边',
  '2': '集中',
  '3': '挂牌',
  '4': '连续竞价',
  '9': '其他',
};

export const TRADE_TYPE_MODE_OPTIONS = [
  { label: '双边', value: TRADE_TYPE.BILATERAL },
  { label: '集中', value: TRADE_TYPE.CONCENTRATE },
  { label: '挂牌', value: TRADE_TYPE.LISTED },
  { label: '连续竞价', value: TRADE_TYPE.CONTINUOUS_AUCTION },
  { label: '其他', value: TRADE_TYPE.ORTHER },
];

export const ADD_MENU_LIST = [
  { label: '待办', value: 'todo' },
  { label: '公告', value: 'notice' },
  { label: '交易序列', value: 'sequence' },
];

export const TODO_OPTIONS_LIST = [
  { label: '创建', value: 1 },
  // { label: '提醒设置', value: 2 },
  { label: '删除', value: 3 },
];

export const NOTICE_SEQUENCE_OPTIONS_LIST = [
  { label: '创建待办', value: 1 },
  { label: '删除', value: 2 },
];

export const FREQUENCY_OPTIONS = [
  {
    label: '每天',
    value: 'day',
    children: [],
  },
  {
    label: '每周',
    value: 'week',
    children: [
      { label: '周一', value: 1 },
      { label: '周二', value: 2 },
      { label: '周三', value: 3 },
      { label: '周四', value: 4 },
      { label: '周五', value: 5 },
      { label: '周六', value: 6 },
      { label: '周日', value: 7 },
    ],
  },
  {
    label: '每月',
    value: 'month',
    children: repeatMonth(),
  },
];

export enum PERSON_STATUS {
  SELECT = 'select',
  EDIT = 'edit',
}

export enum PERSON_OPTIONS_STATUS {
  USER = 'user',
  STATION = 'station',
  GROUP_NAME = 'groupName',
}

export enum GROUP_OPTION_TYPE {
  ADD = 'add',
  UPDATE = 'update',
  DEL = 'del',
}

export const CONNECT_TYPE = [
  { label: '全部', value: TABS_LIST.NOTICE_SEQUENCE_TABS_TYPE },
  { label: '公告', value: TABS_LIST.NOTICE_TABS_TYPE },
  { label: '交易序列', value: TABS_LIST.SEQUENCE_TABS_TYPE },
];

export const BATCH_TODO_CONTENT_TYPE = [
  { label: '引用公告/序列标题', value: 1 },
  { label: '自定义', value: 2 },
];

export const STATION_LIST_TYPE = [
  { label: '引用公告/序列对应单元', value: 1 },
  { label: '自定义', value: 2 },
];

export const PENDING_TIME_TYPE = [
  { label: '优先引用交易时间', value: 1 },
  { label: '全部应用自定义', value: 2 },
];
